<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      class MikaSet {
        #items = {};

        add(element) {
          if (this.has(element)) return false;

          this.#items[element] = element;
          return true;
        }

        delete(element) {
          if (!this.has(element)) return false;

          delete this.#items[element];
          return true;
        }

        has(element) {
          return element in this.#items;
        }

        clear() {
          this.#items = {};
        }

        size() {
          return Object.keys(this.#items).length;
        }

        values() {
          return Object.values(this.#items);
        }
      }

      const ms = new MikaSet();

      const fun = (array) => {
        let set = new MikaSet();
        array.forEach((item) => {
          set.add(item);
        });
        return set.values();
      };

      let arr = [1, 2, 3, 1, 2, 3];

      console.log(fun(arr));
    </script>
  </body>
</html>
